package com.yyysj.friend.controller;

import com.yyysj.api.domain.vo.UserQuestionResultVO;
import com.yyysj.common.core.domain.Result;
import com.yyysj.friend.domain.dto.UserSubmitDTO;
import com.yyysj.friend.service.IUserQuestionService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/question")
@RequiredArgsConstructor
public class UserQuestionController {

    private final IUserQuestionService userQuestionService;

    @PostMapping("/submit")
    public Result<UserQuestionResultVO> submit(@RequestBody UserSubmitDTO submitDTO) {
        return userQuestionService.submit(submitDTO);
    }

    @PostMapping("/rabbit/submit")
    public Result<Void> rabbitSubmit(@RequestBody UserSubmitDTO submitDTO) {
        return Result.build(userQuestionService.rabbitSubmit(submitDTO));
    }

    @GetMapping("/exe/result")
    public  Result<UserQuestionResultVO> exeResult(Long examId, Long questionId, String currentTime) {
        return Result.ok(userQuestionService.exeResult(examId, questionId, currentTime));
    }
}
